home *** CD-ROM | disk | FTP | other *** search
- Path: pop.gnn.com!HoangTQ
- From: Tuyen Hoang <HoangTQ@gnn.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Derived class not calling overloaded base class function
- Date: Sat, 16 Mar 1996 17:26:03
- Organization: GNN
- Message-ID: <4iff2g$p2i@news-e2b.gnn.com>
- References: <4g46t2$3vd@otis.netspace.net.au> <Dn3778.CK1@news.arco.com>
- NNTP-Posting-Host: www-41-87.gnn.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset="us-ascii"
- X-GNN-NewsServer-Posting-Date: 16 Mar 1996 22:24:16 GMT
- X-Mailer: GNNmessenger 1.2
-
- an illustration
- goo angoo;
- angoo.foo::get(); //now the get(void) in foo gets called
-
- If you hate this syntax -I do- and want to use angoo.get() to call the base
- class function, you need to do one *easy* thing: add the follow line into
- your definition of class goo
-
- class goo : public foo{
- //...
- void get() { foo::get() ; }
- //...
- };
-
- that's all, but the concept is not easy. If you want some explanation, you
- should look back the thread and the FAQ. As my experience, I usually need an
- illustration before I can understand the theorical explanation.
-
- Then this is my question
- Do we need a more elegant way than this work around. I want to have a way to
- say to the compiler that I do not declare a new function-inlining and calling
- the base function- but notify that the base function is now _unhiding_ from
- the derived overloaded function, something look like
-
- class derived : public base{
- //....
- public:
- void get(int);
- /* unhiding */ void base::get();
- //....
- };
-
- the problem is not concern about one or more overhead calls but the concept
- that the base function is now *explicit* present in the derived class and can
- be overloaded as it was declared here. Does the virtual key word is
- needed/no needed?
-
- Regard
- Tuyen Hoang
-
-